package com.application.bisabahasakorea;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MenuAngkaAdapter extends ArrayAdapter<String> {
	private final Context context;
	private final String[] values;
	
	public MenuAngkaAdapter(Context context, String[] values){
		super(context, R.layout.row_menu_angka, values);
		this.context = context;
		this.values = values;
	}
	
	public View getView(int position, View convertView, ViewGroup parent){
		LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View rowView = inflater.inflate(R.layout.row_menu_angka, parent, false);
		TextView textView = (TextView) rowView.findViewById(R.id.label);
		ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
		textView.setText(values[position]);
		
		//change icon based on name
		String s = values[position];
		
		System.out.println(s);
		
		if (s.equals("Angka Asli")){
			imageView.setImageResource(R.drawable.ic_number);
		}else{
			imageView.setImageResource(R.drawable.ic_number);
		}
		
		return rowView;
	}
}
